import { Loading } from "element-ui";
import Vue from 'vue';

class LoadingUtils {
    constructor() {
        this.loadingInstance = null;
    }

    loading(text) {
        this.loadingInstance = Loading.service({text: text});
    }

    close() {
        Vue.nextTick(() => {
            if(this.loadingInstance) { this.loadingInstance.close(); }
        })
    }
}
export const loadingUtils = new LoadingUtils();